# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AppEngine.V1.Model.ContainerState do
  @moduledoc """
  ContainerState contains the externally-visible container state that is used to communicate the state and reasoning for that state to the CLH. This data is not persisted by CCFE, but is instead derived from CCFE's internal representation of the container state.

  ## Attributes

  *   `currentReasons` (*type:* `GoogleApi.AppEngine.V1.Model.Reasons.t`, *default:* `nil`) - 
  *   `previousReasons` (*type:* `GoogleApi.AppEngine.V1.Model.Reasons.t`, *default:* `nil`) - The previous and current reasons for a container state will be sent for a container event. CLHs that need to know the signal that caused the container event to trigger (edges) as opposed to just knowing the state can act upon differences in the previous and current reasons.Reasons will be provided for every system: service management, data governance, abuse, and billing.If this is a CCFE-triggered event used for reconciliation then the current reasons will be set to their *_CONTROL_PLANE_SYNC state. The previous reasons will contain the last known set of non-unknown non-control_plane_sync reasons for the state.
  *   `state` (*type:* `String.t`, *default:* `nil`) - The current state of the container. This state is the culmination of all of the opinions from external systems that CCFE knows about of the container.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :currentReasons => GoogleApi.AppEngine.V1.Model.Reasons.t() | nil,
          :previousReasons => GoogleApi.AppEngine.V1.Model.Reasons.t() | nil,
          :state => String.t() | nil
        }

  field(:currentReasons, as: GoogleApi.AppEngine.V1.Model.Reasons)
  field(:previousReasons, as: GoogleApi.AppEngine.V1.Model.Reasons)
  field(:state)
end

defimpl Poison.Decoder, for: GoogleApi.AppEngine.V1.Model.ContainerState do
  def decode(value, options) do
    GoogleApi.AppEngine.V1.Model.ContainerState.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AppEngine.V1.Model.ContainerState do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
